import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WaterMeterVO, WaterMeterForm, WaterMeterQuery } from '@/api/house/waterMeter/types';

/**
 * 查询水表信息列表
 * @param query
 * @returns {*}
 */

export const listWaterMeter = (query?: WaterMeterQuery): AxiosPromise<WaterMeterVO[]> => {
  return request({
    url: '/house/waterMeter/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询水表信息详细
 * @param id
 */
export const getWaterMeter = (id: string | number): AxiosPromise<WaterMeterVO> => {
  return request({
    url: '/house/waterMeter/' + id,
    method: 'get'
  });
};

/**
 * 新增水表信息
 * @param data
 */
export const addWaterMeter = (data: WaterMeterForm) => {
  return request({
    url: '/house/waterMeter',
    method: 'post',
    data: data
  });
};

/**
 * 修改水表信息
 * @param data
 */
export const updateWaterMeter = (data: WaterMeterForm) => {
  return request({
    url: '/house/waterMeter',
    method: 'put',
    data: data
  });
};

/**
 * 删除水表信息
 * @param id
 */
export const delWaterMeter = (id: string | number | Array<string | number>) => {
  return request({
    url: '/house/waterMeter/' + id,
    method: 'delete'
  });
};
